from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
import settings, models
import logging
from google.appengine.api import users

class IndexHandler(webapp.RequestHandler):
    def get(self):
        template_values = settings.base_template_data(self.request)
        path = settings.template_path('index')
        self.response.out.write(template.render(path, template_values))
        
        
class LayarLoginHandler(webapp.RequestHandler):
    def get(self):
        template_values = settings.base_template_data(self.request)
        if template_values['user']:
            self.redirect('/profile')
        else:
            url = users.create_login_url('http://dev.layar.com/media/getbacktoapp.html')
            self.redirect(url)
